Skip to content

refactor(runners): rewrite pre-2018 ref-patterns to match ergonomics - #90

Merged
jhamill34 merged 1 commit into
mainfrom
claude/issue-1-phase2-runners
Aug 26, 2026
Merged

refactor(runners): rewrite pre-2018 ref-patterns to match ergonomics#90
jhamill34 merged 1 commit into
mainfrom
claude/issue-1-phase2-runners

Conversation

@jhamill34

Copy link
Copy Markdown
Owner

Summary

Part of #85 (Phase 2 of #1). Stacked on #89 (usecases/*), which is stacked on #88 (Phase 1's lint policy).

Same transform as #89, applied to runners/*:

  • if let &Some(ref x) = &y { ... }if let Some(x) = &y { ... }
  • match &value { &Variant(ref x) => ..., ... }match value { Variant(x) => ..., ... }
  • if let &mut Value::Object(ref mut x) = &mut y { ... }if let Value::Object(x) = &mut y { ... } (same rule for mutable references — filtered_runner and python_runner each had one of these; note clippy::ref_patterns/needless_borrowed_reference don't actually flag &mut/ref mut shapes, so these two were found by re-checking against the original site inventory rather than clippy's own output — worth keeping in mind for Phase 2 of #1: rewrite ~86 pre-2018 ref-pattern sites to match ergonomics #85's remaining binary/* PR)

Crates touched:

  • api_caller (23 sites — 2 more than originally scoped: two near-duplicate functions each repeat the same 4-arm pagination match, and two request-limit resolvers repeat the same Number-coercion match, all now fixed).
  • filtered_runner (2 sites, one &mut shape).
  • python_runner (1 site, &mut shape in bindings.rs).

All three crates now have zero ref_patterns/match_ref_pats/needless_borrowed_reference warnings.

Test plan

  • cargo build -p api_caller -p filtered_runner -p python_runner --all-features — clean.
  • cargo clippy -p api_caller -p filtered_runner -p python_runner --all-features — zero warnings from the three targeted lints.
  • cargo test -p api_caller -p filtered_runner -p python_runner --all-features — 7 tests, 0 failures.
  • cargo build --workspace --all-features / cargo test --workspace --all-features — clean, zero failures.
  • cargo fmt --all -- --check — clean.

Generated by Claude Code

Part of #85 (Phase 2 of #1). Converts every &Some(ref x)/match &value {
&Variant(ref x) => ... }/&mut Value::Object(ref mut x) site in api_caller,
filtered_runner, and python_runner to plain match-ergonomics form --
purely syntactic, binds the identical (mutable or immutable) reference
type as before.

api_caller had two duplicated pagination-matching functions (find_results
and the page-size calculator) each repeating the same 4-arm match, plus
duplicated Number-coercion matches in two request-limit resolvers --
fixed all instances in each. filtered_runner and python_runner each had
one &mut/ref mut site not caught by these clippy lints (which don't cover
&mut patterns) but flagged by the same #85 inventory as the same
anti-pattern.

All three crates now have zero clippy::ref_patterns/match_ref_pats/
needless_borrowed_reference warnings.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018VzKriyNnMHmqQ6UxPhsv2
@jhamill34
jhamill34 force-pushed the claude/issue-1-phase2-runners branch from 63b7593 to 846bbde Compare August 26, 2026 23:50
@jhamill34
jhamill34 merged commit 3d77252 into main Aug 26, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants